package spring;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.sql.DataSource;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

public class TestBean34 {
	private DataSource mysqlDataSource;
	private DataSource oracleDataSource;

	@Autowired
	public void initDataSource(
			@DataSourceType(ip = "localhost", database = DataBase.MYSQL) DataSource mysqlDataSource,
			@DataSourceType(ip = "localhost", database = DataBase.ORACLE) DataSource oracleDataSource) {
		this.mysqlDataSource = mysqlDataSource;
		this.oracleDataSource = oracleDataSource;
	}

	public DataSource getMysqlDataSource() {
		return mysqlDataSource;
	}

	public void setMysqlDataSource(DataSource mysqlDataSource) {
		this.mysqlDataSource = mysqlDataSource;
	}

	public DataSource getOracleDataSource() {
		return oracleDataSource;
	}

	public void setOracleDataSource(DataSource oracleDataSource) {
		this.oracleDataSource = oracleDataSource;
	}

	@PostConstruct
	public void init() {
	    System.out.println("==========init");
	}
	@PreDestroy
	public void destroy() {
	    System.out.println("==========destroy");
	}
}
